package controller

import (
	"gin/dao"
	"gin/model"
	"gin/tool"
	"github.com/gin-gonic/gin"
	"time"
)

type IndexController struct {
}

func (index *IndexController) Router(engine *gin.Engine) {
	//engine.GET("/indexList",index.IndexList)
	engine.GET("/indexList", index.IndexList)
	engine.GET("/addSmsCode", index.AddSmsCode)
}
func (index *IndexController) IndexList(c *gin.Context) {
	c.JSON(200, map[string]interface{}{
		"code": 200,
		"msg":  "success",
	})
}
func (index *IndexController) AddSmsCode(c *gin.Context) {
	SmsCode := model.SmsCode{
		Mobile: "18569948716",
		Code:   "6658",
		BizId:  "kjdshkjdsf154ds5gf52dg454",
		Ctime:  time.Now().Unix(),
	}
	MemberDao := dao.MemberDao{Orm: tool.DbEngine}
	result := MemberDao.InsertCode(SmsCode)
	c.JSON(200, map[string]interface{}{
		"code": 200,
		"msg":  "success",
		"data": result,
	})
}
